package com.code.petapp.util;

import android.util.Log;

import com.code.petapp.bean.GoodsBean;
import com.code.petapp.bean.HealthBean;
import com.code.petapp.http.HttpApiService;
import com.code.petapp.http.HttpListener;
import com.code.petapp.http.RetrofitHelper;
import com.code.petapp.http.RxObserver;

import java.util.ArrayList;

public class HealthUtils {
    public static void selectAll(String token,int id, HttpListener<ArrayList<HealthBean>> httpListener){
        Log.d("Tag","select start");
        new RetrofitHelper().createApi(HttpApiService.class)
                .selectAllHealth(token,id)
                .compose(RetrofitHelper.schedulersTransformer())
                .subscribe(new RxObserver<>() {
                    @Override
                    public void success(ArrayList<HealthBean> baseBean) {
                        httpListener.success(baseBean);
                    }

                    @Override
                    public void error(int code, String error) {
                        httpListener.error(code,error);
                    }
                });
    }
}
